﻿namespace Quail
{
    /// <summary>
    /// Interface for multi-valued web controls
    /// </summary>
    public interface IWebControlWithItems
    {
        /// <summary>
        /// Gets a count of all the items in the control  (Labels.Count == Values.Count == CountItems)
        /// </summary>
        int ItemCount { get; }

        /// <summary>
        /// Gets a list of all the labels for the control
        /// </summary>
        string[] Labels { get; }

        /// <summary>
        /// Gets or sets the label of the control
        /// </summary>
        string Label { get; set; }

        /// <summary>
        /// Gets a list of all the values for the control
        /// </summary>
        string[] Values { get; }

        /// <summary>
        /// Gets or sets the value of the control
        /// </summary>
        string Value { get; set; }

        /// <summary>
        /// Gets the selector for the control
        /// </summary>
        string Selector { get; }

        /// <summary>
        /// Gets or sets the selected index
        /// </summary>
        int SelectedIndex { get; set; }

        /// <summary>
        /// Gets the label for a specific item index
        /// </summary>
        /// <param name="index">the index to get</param>
        /// <returns>the label value</returns>
        string GetLabel(int index);

        /// <summary>
        /// Gets the value for a specific item index
        /// </summary>
        /// <param name="index">the index to get</param>
        /// <returns>the value of the item</returns>
        string GetValue(int index);

        /// <summary>
        /// Checks to see if a value is represented in the list
        /// </summary>
        /// <param name="value">The value to search for</param>
        /// <returns>True if the value is in the group</returns>
        bool ValueExists(string value);

        /// <summary>
        /// Checks to see if a label is represented in the list
        /// </summary>
        /// <param name="label">The label to search for</param>
        /// <returns>True if the label is in the group</returns>
        bool LabelExists(string label);

        /// <summary>
        /// Selects a random item from the list
        /// </summary>
        /// <param name="selectDifferentValue">If the value should be different than the currently selected value</param>
        void SelectRandomValue(bool selectDifferentValue);

        /// <summary>
        /// Selects a random item from the list
        /// </summary>
        void SelectRandomValue();
    }
}
